package com.xbongbong.pro.statistic.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * 统计图类型相关枚举
 *
 * @author zhouwq
 * @date 2019/4/16 16:30
 */

@Getter
public enum ChartAggResultEnum {

    /**
     * 统计图返回字段类型
     */

    X_AXIS("xAxis","enum.chartAggResult.describe.x_axis"),

    LEGEND("legend","enum.chartAggResult.describe.legend"),

    COUNT("count","enum.chartAggResult.describe.count"),

    DOC_COUNT("doc_count","enum.chartAggResult.describe.doc_count"),

    SERIAL_DIFF("serial_diff", "enum.chartAggResult.describe.serial_diff"),

    SCATTER_SIZE("scatterSize","enum.chartAggResult.describe.scatter_size")
    ;

    /**
     * 字段值
     */
    private final String str;
    /**
     * 字段描述
     */
    private final String describe;


    ChartAggResultEnum(String str, String describe){
        this.str = str;
        this.describe = describe;
    }

    public String getDescribe() {
        if (Objects.equals(describe, "")) {
            return describe;
        } else {
            return I18nMessageUtil.getMessage(describe);
        }
    }
}
